package cn.itsource.ymcc.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RedissonConfig {

    //创建客户端
    @Bean
    public RedissonClient redissonClient(){
        Config config = new Config();
        config.useSingleServer().setAddress("redis://127.0.0.1:6379").setPassword("123");
//        config.useClusterServers()
//                .addNodeAddress("redis://127.0.0.1:6379","redis://127.0.0.1:6380","redis://127.0.0.1:6381","redis://127.0.0.1:6382","redis://127.0.0.1:6383","redis://127.0.0.1:6384")
//                .setPassword("123456");
        return Redisson.create(config);
    }
}
